package com.ficus.road.maintain.service.smartnew;

import com.ficus.road.maintain.core.model.smartnew.SmartValuation;
import com.ficus.road.maintain.dao.smartnew.SmartValuationMergedDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author xiawen yang
 * @date 2022/7/27 上午10:54
 */
@Component
public class SmartValuationService {

    private static final Map<String, Double> greenProjectMap;

    static {
        greenProjectMap = Map.of(
//                "桥梁改造加固工程", 1500d,
//                "人行道、树穴盖板改造", 1000d,
//                "独柱墩改造工程", 3700d,
//                "护栏更新工程", 200d,
//                "道路综合整治工程（预防性养护）", 2000d,
//                "花卉工程", 300d,
//                "泵站改造工程", 326d,
//                "生命安全防护工程", 300d,
//                "交通设施完善工程", 300d
        );
    }

    @Autowired
    private SmartValuationMergedDao smartValuationMergedDao;

    public void addGreenProject() {
        greenProjectMap.forEach((name, money) -> {
            SmartValuation smartValuation = new SmartValuation(name, money);
            smartValuationMergedDao.saveOrUpdate(smartValuation);
        });
    }
}
